<?php
/*
 * etc:管理员登录模型层
 * author:yyz
 */
class MadminLogin extends Model{
	function loginTime( $user_id ){
		$sql = "update  bc_admin SET admin_login_time = NOW() WHERE admin_id = '".$user_id."'";
		$this->db->query( $sql );
		return 1;
	}
	
	function userLogin( $account,$password ){
		$sql = "SELECT admin_id,admin_account,admin_pwd,admin_login_time
			FROM bc_admin
			WHERE (admin_account = '".$account."')
			AND  admin_pwd  = '".$password."' ";
		$result = $this->db->fetch_all( $sql );
		return $result;
	}
	function confirmPassword( $admin_id,$admin_password ){
		$sql = "select * from bc_admin where admin_id = '".$admin_id."' AND admin_pwd = '".$admin_password."'";
		$result = $this->db->fetch_all( $sql );
		return $result;
	}
	//管理员：查询管理员List
	function searchAdminList( $curPage , $pageSize ){
		$sql = "select * from bc_admin order by admin_login_time desc limit ".($curPage-1)*$pageSize.",".$pageSize;
		//var_dump($sql);
		$result = $this->db->fetch_all( $sql );
		return $result;
	}
	//管理员数量
	function searchAdminNum(){
		$sql = "select count(*) as num from bc_admin";
		$result = $this->db->fetch_all( $sql );
		return $result;
	}
	
}